#pragma once
// MESSAGE SET_PID6 PACKING

#define MAVLINK_MSG_ID_SET_PID6 196

MAVPACKED(
typedef struct __mavlink_set_pid6_t {
 int16_t pid16_p; /*<  PID16_P*/
 int16_t pid16_i; /*<  PID16_I*/
 int16_t pid16_d; /*<  PID16_D*/
 int16_t pid17_p; /*<  PID17_P*/
 int16_t pid17_i; /*<  PID17_I*/
 int16_t pid17_d; /*<  PID17_D*/
 int16_t pid18_p; /*<  PID18_P*/
 int16_t pid18_i; /*<  PID18_I*/
 int16_t pid18_d; /*<  PID18_D*/
}) mavlink_set_pid6_t;

#define MAVLINK_MSG_ID_SET_PID6_LEN 18
#define MAVLINK_MSG_ID_SET_PID6_MIN_LEN 18
#define MAVLINK_MSG_ID_196_LEN 18
#define MAVLINK_MSG_ID_196_MIN_LEN 18

#define MAVLINK_MSG_ID_SET_PID6_CRC 41
#define MAVLINK_MSG_ID_196_CRC 41



#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_SET_PID6 { \
    196, \
    "SET_PID6", \
    9, \
    {  { "pid16_p", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_set_pid6_t, pid16_p) }, \
         { "pid16_i", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_set_pid6_t, pid16_i) }, \
         { "pid16_d", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_set_pid6_t, pid16_d) }, \
         { "pid17_p", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_set_pid6_t, pid17_p) }, \
         { "pid17_i", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_set_pid6_t, pid17_i) }, \
         { "pid17_d", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_set_pid6_t, pid17_d) }, \
         { "pid18_p", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_set_pid6_t, pid18_p) }, \
         { "pid18_i", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_set_pid6_t, pid18_i) }, \
         { "pid18_d", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_set_pid6_t, pid18_d) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_SET_PID6 { \
    "SET_PID6", \
    9, \
    {  { "pid16_p", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_set_pid6_t, pid16_p) }, \
         { "pid16_i", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_set_pid6_t, pid16_i) }, \
         { "pid16_d", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_set_pid6_t, pid16_d) }, \
         { "pid17_p", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_set_pid6_t, pid17_p) }, \
         { "pid17_i", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_set_pid6_t, pid17_i) }, \
         { "pid17_d", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_set_pid6_t, pid17_d) }, \
         { "pid18_p", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_set_pid6_t, pid18_p) }, \
         { "pid18_i", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_set_pid6_t, pid18_i) }, \
         { "pid18_d", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_set_pid6_t, pid18_d) }, \
         } \
}
#endif

/**
 * @brief Pack a set_pid6 message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param pid16_p  PID16_P
 * @param pid16_i  PID16_I
 * @param pid16_d  PID16_D
 * @param pid17_p  PID17_P
 * @param pid17_i  PID17_I
 * @param pid17_d  PID17_D
 * @param pid18_p  PID18_P
 * @param pid18_i  PID18_I
 * @param pid18_d  PID18_D
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_set_pid6_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
                               int16_t pid16_p, int16_t pid16_i, int16_t pid16_d, int16_t pid17_p, int16_t pid17_i, int16_t pid17_d, int16_t pid18_p, int16_t pid18_i, int16_t pid18_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_SET_PID6_LEN];
    _mav_put_int16_t(buf, 0, pid16_p);
    _mav_put_int16_t(buf, 2, pid16_i);
    _mav_put_int16_t(buf, 4, pid16_d);
    _mav_put_int16_t(buf, 6, pid17_p);
    _mav_put_int16_t(buf, 8, pid17_i);
    _mav_put_int16_t(buf, 10, pid17_d);
    _mav_put_int16_t(buf, 12, pid18_p);
    _mav_put_int16_t(buf, 14, pid18_i);
    _mav_put_int16_t(buf, 16, pid18_d);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_PID6_LEN);
#else
    mavlink_set_pid6_t packet;
    packet.pid16_p = pid16_p;
    packet.pid16_i = pid16_i;
    packet.pid16_d = pid16_d;
    packet.pid17_p = pid17_p;
    packet.pid17_i = pid17_i;
    packet.pid17_d = pid17_d;
    packet.pid18_p = pid18_p;
    packet.pid18_i = pid18_i;
    packet.pid18_d = pid18_d;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_PID6_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_SET_PID6;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_PID6_MIN_LEN, MAVLINK_MSG_ID_SET_PID6_LEN, MAVLINK_MSG_ID_SET_PID6_CRC);
}

/**
 * @brief Pack a set_pid6 message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param pid16_p  PID16_P
 * @param pid16_i  PID16_I
 * @param pid16_d  PID16_D
 * @param pid17_p  PID17_P
 * @param pid17_i  PID17_I
 * @param pid17_d  PID17_D
 * @param pid18_p  PID18_P
 * @param pid18_i  PID18_I
 * @param pid18_d  PID18_D
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_set_pid6_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
                               mavlink_message_t* msg,
                                   int16_t pid16_p,int16_t pid16_i,int16_t pid16_d,int16_t pid17_p,int16_t pid17_i,int16_t pid17_d,int16_t pid18_p,int16_t pid18_i,int16_t pid18_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_SET_PID6_LEN];
    _mav_put_int16_t(buf, 0, pid16_p);
    _mav_put_int16_t(buf, 2, pid16_i);
    _mav_put_int16_t(buf, 4, pid16_d);
    _mav_put_int16_t(buf, 6, pid17_p);
    _mav_put_int16_t(buf, 8, pid17_i);
    _mav_put_int16_t(buf, 10, pid17_d);
    _mav_put_int16_t(buf, 12, pid18_p);
    _mav_put_int16_t(buf, 14, pid18_i);
    _mav_put_int16_t(buf, 16, pid18_d);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_PID6_LEN);
#else
    mavlink_set_pid6_t packet;
    packet.pid16_p = pid16_p;
    packet.pid16_i = pid16_i;
    packet.pid16_d = pid16_d;
    packet.pid17_p = pid17_p;
    packet.pid17_i = pid17_i;
    packet.pid17_d = pid17_d;
    packet.pid18_p = pid18_p;
    packet.pid18_i = pid18_i;
    packet.pid18_d = pid18_d;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_PID6_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_SET_PID6;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SET_PID6_MIN_LEN, MAVLINK_MSG_ID_SET_PID6_LEN, MAVLINK_MSG_ID_SET_PID6_CRC);
}

/**
 * @brief Encode a set_pid6 struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param set_pid6 C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_set_pid6_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_pid6_t* set_pid6)
{
    return mavlink_msg_set_pid6_pack(system_id, component_id, msg, set_pid6->pid16_p, set_pid6->pid16_i, set_pid6->pid16_d, set_pid6->pid17_p, set_pid6->pid17_i, set_pid6->pid17_d, set_pid6->pid18_p, set_pid6->pid18_i, set_pid6->pid18_d);
}

/**
 * @brief Encode a set_pid6 struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param set_pid6 C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_set_pid6_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_set_pid6_t* set_pid6)
{
    return mavlink_msg_set_pid6_pack_chan(system_id, component_id, chan, msg, set_pid6->pid16_p, set_pid6->pid16_i, set_pid6->pid16_d, set_pid6->pid17_p, set_pid6->pid17_i, set_pid6->pid17_d, set_pid6->pid18_p, set_pid6->pid18_i, set_pid6->pid18_d);
}

/**
 * @brief Send a set_pid6 message
 * @param chan MAVLink channel to send the message
 *
 * @param pid16_p  PID16_P
 * @param pid16_i  PID16_I
 * @param pid16_d  PID16_D
 * @param pid17_p  PID17_P
 * @param pid17_i  PID17_I
 * @param pid17_d  PID17_D
 * @param pid18_p  PID18_P
 * @param pid18_i  PID18_I
 * @param pid18_d  PID18_D
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_set_pid6_send(mavlink_channel_t chan, int16_t pid16_p, int16_t pid16_i, int16_t pid16_d, int16_t pid17_p, int16_t pid17_i, int16_t pid17_d, int16_t pid18_p, int16_t pid18_i, int16_t pid18_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_SET_PID6_LEN];
    _mav_put_int16_t(buf, 0, pid16_p);
    _mav_put_int16_t(buf, 2, pid16_i);
    _mav_put_int16_t(buf, 4, pid16_d);
    _mav_put_int16_t(buf, 6, pid17_p);
    _mav_put_int16_t(buf, 8, pid17_i);
    _mav_put_int16_t(buf, 10, pid17_d);
    _mav_put_int16_t(buf, 12, pid18_p);
    _mav_put_int16_t(buf, 14, pid18_i);
    _mav_put_int16_t(buf, 16, pid18_d);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID6, buf, MAVLINK_MSG_ID_SET_PID6_MIN_LEN, MAVLINK_MSG_ID_SET_PID6_LEN, MAVLINK_MSG_ID_SET_PID6_CRC);
#else
    mavlink_set_pid6_t packet;
    packet.pid16_p = pid16_p;
    packet.pid16_i = pid16_i;
    packet.pid16_d = pid16_d;
    packet.pid17_p = pid17_p;
    packet.pid17_i = pid17_i;
    packet.pid17_d = pid17_d;
    packet.pid18_p = pid18_p;
    packet.pid18_i = pid18_i;
    packet.pid18_d = pid18_d;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID6, (const char *)&packet, MAVLINK_MSG_ID_SET_PID6_MIN_LEN, MAVLINK_MSG_ID_SET_PID6_LEN, MAVLINK_MSG_ID_SET_PID6_CRC);
#endif
}

/**
 * @brief Send a set_pid6 message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_set_pid6_send_struct(mavlink_channel_t chan, const mavlink_set_pid6_t* set_pid6)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_set_pid6_send(chan, set_pid6->pid16_p, set_pid6->pid16_i, set_pid6->pid16_d, set_pid6->pid17_p, set_pid6->pid17_i, set_pid6->pid17_d, set_pid6->pid18_p, set_pid6->pid18_i, set_pid6->pid18_d);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID6, (const char *)set_pid6, MAVLINK_MSG_ID_SET_PID6_MIN_LEN, MAVLINK_MSG_ID_SET_PID6_LEN, MAVLINK_MSG_ID_SET_PID6_CRC);
#endif
}

#if MAVLINK_MSG_ID_SET_PID6_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This varient of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_set_pid6_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  int16_t pid16_p, int16_t pid16_i, int16_t pid16_d, int16_t pid17_p, int16_t pid17_i, int16_t pid17_d, int16_t pid18_p, int16_t pid18_i, int16_t pid18_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char *buf = (char *)msgbuf;
    _mav_put_int16_t(buf, 0, pid16_p);
    _mav_put_int16_t(buf, 2, pid16_i);
    _mav_put_int16_t(buf, 4, pid16_d);
    _mav_put_int16_t(buf, 6, pid17_p);
    _mav_put_int16_t(buf, 8, pid17_i);
    _mav_put_int16_t(buf, 10, pid17_d);
    _mav_put_int16_t(buf, 12, pid18_p);
    _mav_put_int16_t(buf, 14, pid18_i);
    _mav_put_int16_t(buf, 16, pid18_d);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID6, buf, MAVLINK_MSG_ID_SET_PID6_MIN_LEN, MAVLINK_MSG_ID_SET_PID6_LEN, MAVLINK_MSG_ID_SET_PID6_CRC);
#else
    mavlink_set_pid6_t *packet = (mavlink_set_pid6_t *)msgbuf;
    packet->pid16_p = pid16_p;
    packet->pid16_i = pid16_i;
    packet->pid16_d = pid16_d;
    packet->pid17_p = pid17_p;
    packet->pid17_i = pid17_i;
    packet->pid17_d = pid17_d;
    packet->pid18_p = pid18_p;
    packet->pid18_i = pid18_i;
    packet->pid18_d = pid18_d;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID6, (const char *)packet, MAVLINK_MSG_ID_SET_PID6_MIN_LEN, MAVLINK_MSG_ID_SET_PID6_LEN, MAVLINK_MSG_ID_SET_PID6_CRC);
#endif
}
#endif

#endif

// MESSAGE SET_PID6 UNPACKING


/**
 * @brief Get field pid16_p from set_pid6 message
 *
 * @return  PID16_P
 */
static inline int16_t mavlink_msg_set_pid6_get_pid16_p(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  0);
}

/**
 * @brief Get field pid16_i from set_pid6 message
 *
 * @return  PID16_I
 */
static inline int16_t mavlink_msg_set_pid6_get_pid16_i(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  2);
}

/**
 * @brief Get field pid16_d from set_pid6 message
 *
 * @return  PID16_D
 */
static inline int16_t mavlink_msg_set_pid6_get_pid16_d(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  4);
}

/**
 * @brief Get field pid17_p from set_pid6 message
 *
 * @return  PID17_P
 */
static inline int16_t mavlink_msg_set_pid6_get_pid17_p(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  6);
}

/**
 * @brief Get field pid17_i from set_pid6 message
 *
 * @return  PID17_I
 */
static inline int16_t mavlink_msg_set_pid6_get_pid17_i(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  8);
}

/**
 * @brief Get field pid17_d from set_pid6 message
 *
 * @return  PID17_D
 */
static inline int16_t mavlink_msg_set_pid6_get_pid17_d(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  10);
}

/**
 * @brief Get field pid18_p from set_pid6 message
 *
 * @return  PID18_P
 */
static inline int16_t mavlink_msg_set_pid6_get_pid18_p(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  12);
}

/**
 * @brief Get field pid18_i from set_pid6 message
 *
 * @return  PID18_I
 */
static inline int16_t mavlink_msg_set_pid6_get_pid18_i(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  14);
}

/**
 * @brief Get field pid18_d from set_pid6 message
 *
 * @return  PID18_D
 */
static inline int16_t mavlink_msg_set_pid6_get_pid18_d(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  16);
}

/**
 * @brief Decode a set_pid6 message into a struct
 *
 * @param msg The message to decode
 * @param set_pid6 C-struct to decode the message contents into
 */
static inline void mavlink_msg_set_pid6_decode(const mavlink_message_t* msg, mavlink_set_pid6_t* set_pid6)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    set_pid6->pid16_p = mavlink_msg_set_pid6_get_pid16_p(msg);
    set_pid6->pid16_i = mavlink_msg_set_pid6_get_pid16_i(msg);
    set_pid6->pid16_d = mavlink_msg_set_pid6_get_pid16_d(msg);
    set_pid6->pid17_p = mavlink_msg_set_pid6_get_pid17_p(msg);
    set_pid6->pid17_i = mavlink_msg_set_pid6_get_pid17_i(msg);
    set_pid6->pid17_d = mavlink_msg_set_pid6_get_pid17_d(msg);
    set_pid6->pid18_p = mavlink_msg_set_pid6_get_pid18_p(msg);
    set_pid6->pid18_i = mavlink_msg_set_pid6_get_pid18_i(msg);
    set_pid6->pid18_d = mavlink_msg_set_pid6_get_pid18_d(msg);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_SET_PID6_LEN? msg->len : MAVLINK_MSG_ID_SET_PID6_LEN;
        memset(set_pid6, 0, MAVLINK_MSG_ID_SET_PID6_LEN);
    memcpy(set_pid6, _MAV_PAYLOAD(msg), len);
#endif
}
